#ifndef NOTIFICATIONMANAGER_H
#define NOTIFICATIONMANAGER_H

#include <QtCore/QObject>
#include <QtCore/QTimer>
#include <QtCore/QList>
#include <QtWidgets/QSystemTrayIcon>
#include <QtWidgets/QMenu>

class QAction;

class NotificationManager : public QObject
{
    Q_OBJECT

public:
    explicit NotificationManager(QObject *parent = nullptr);
    ~NotificationManager();

    // 显示通知
    void showNotification(const QString &title, const QString &message, int timeout = 5000);
    
    // 启用/禁用系统托盘
    void setTrayEnabled(bool enabled);
    
    // 检查系统托盘是否可用
    bool isTrayAvailable() const;

public slots:
    void onDownloadFinished(const QString &fileName);
    void onDownloadError(const QString &fileName, const QString &error);

private slots:
    void onTrayIconActivated(QSystemTrayIcon::ActivationReason reason);

private:
    void createTrayIcon();
    void showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon icon, int timeout);

    QSystemTrayIcon *m_trayIcon;
    QMenu *m_trayIconMenu;
    bool m_trayEnabled;
};

#endif // NOTIFICATIONMANAGER_H